import axios from 'axios'

const HOST = 'http://192.168.31.197:8000'
// const HOST = 'http://localhost:8000'

// 修改
export const updateStudentInfo = (data, id) => axios.put(`${HOST}/student/${id}/`, data)

// 加载
export const loadAllStudentInfo = (params, config) => axios.get(`${HOST}/student/`, {...config, params})

// 删除
export const loadStudentInfo = (params, id, config) => axios.get(`${HOST}/student/${id}/`, {
  ...config,
  params
})

// 删除
export const deleteStudentInfo = (params, id, config) => axios.delete(`${HOST}/student/${id}/`, {
  ...config,
  params
})


// 修改
export const updateStudentGroup = (data, id) => axios.put(`${HOST}/group//${id}/`, data)

// 加载
export const loadAllStudentGroup = (params, config) => axios.get(`${HOST}/group/`, {...config, params})

// 删除
export const loadStudentGroup = (params, id, config) => axios.get(`${HOST}/group/${id}/`, {
  ...config,
  params
})

// 删除
export const deleteStudentGroup = (params, id, config) => axios.delete(`${HOST}/group/${id}/`, {
  ...config,
  params
})

// 申请请假
export const askForLeave = (data) => axios.post(`${HOST}/for_leave/`, data)

// 设置默认组
export const setDefaultGroup = (data) => axios.post(`${HOST}/set_default/`, data)

// 加载请假记录
export const loadAllRecord = (params, config) => axios.get(`${HOST}/record/`, {...config, params})